package com.lancer.designPattren.c01simpleFactory;

import java.sql.SQLOutput;
import java.util.Scanner;

/**
 * 计算器类，利用简单工厂方法进行计算
 */
public class Calculate {


    public static void main(String[] args) throws Exception {

        Scanner scanner = new Scanner(System.in);


        System.out.println("请输入数字A");
        String numberA = scanner.nextLine();
        System.out.println("请输入运算符");
        String operate = scanner.nextLine();
        System.out.println("请输入数字B");
        String numberB = scanner.nextLine();


        Operation operation = OpetationFactory.CreateOpetation(operate);
        operation.set_numberA(Double.valueOf(numberA));
        operation.set_numberB(Double.valueOf(numberB));


        System.out.println(numberA + " " +  operate + " " + numberB + " = " + operation.getResult());


    }
}
